//@author A0101856J
//The History class allows users to perform operations such as undo and redo.
//Undo will restore the list of tasks to the original state before the most recent operation
// and redo will restore the list of tasks to the original state before the most recent undo.
//Both undo and redo are written to work for undo-able operations such as
// add, delete, edit, and mark. Undo functions will not work for operations such
// as display and summary.
//In addition, the redo operation will be invalid if a user performs an undo-able function
//after the most recent undo.

#ifndef _HISTORY_H_
#define _HISTORY_H_

#include "constants.h"
#include "Parser.h"
#include "TaskList.h"
#include <stack>
#include <vector>

class History
{
private:

	//vector to store undo-able commands
	static std::stack<CommandType> undoCommandStack;
	static std::stack<CommandType> redoCommandStack;
	static std::stack<Task*> undoTaskStack;
	static std::stack<Task*> redoTaskStack;
	static void clearRedoStacks();

public:
	
	~History();
	static void storeAction(CommandType, Task*);
	static void storeAction(CommandType, Task*, Task*);
	static CommandType getPreviousCommand();
	static void getPreviousTaskInfo(Task* &);
	static void deletePreviousCommand();
	static void deletePreviousTask();

	static CommandType getCommandToRedo();
	static void getTaskToRedo(Task* &);
	static void deletePreviousRedo();
	static void deletePreviousRedoTask();

	static ResultType undoPreviousCommand();
	static ResultType redoPreviousCommand();
};

#endif